<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Prettus\Repository\Contracts\Transformable;
use Prettus\Repository\Traits\TransformableTrait;

/**
 * 模型_订单发货状态变更记录
 * Class StatusShippingRecord
 * @package App\Models
 * @author ^2_3^岑业宝
 */
class StatusShippingRecord extends Model implements Transformable
{
    use TransformableTrait;

    /*
    -- 发货状态记录库表
    SET sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));
    CREATE TABLE IF NOT EXISTS sdx_status_shipping_record (
                    id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '记录ID;',
                    order_id MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT 0 COMMENT '订单ID;',
                    old_status TINYINT(1) NOT NULL DEFAULT -1 COMMENT '订单状态旧值;',
                    new_status TINYINT(1) NOT NULL DEFAULT -1 COMMENT '订单状态新值;',
                    notes VARCHAR(255) NOT NULL DEFAULT '' COMMENT '记录说明, 格式如: 0未发货 改成 3备货中;',
                    user_type TINYINT(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '操作用户类型: 0系统默认; 1管理人员; 2用户;',
                    user_id INT(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '操作人员ID;',
                    show4user TINYINT(1) UNSIGNED NOT NULL DEFAULT 1 COMMENT '是否显示给用户, 默认1显示, 0不显示;',
                    created_at timestamp NULL DEFAULT NULL COMMENT '创建时间;',
                    updated_at timestamp NULL DEFAULT NULL COMMENT '更新时间;',

                    PRIMARY KEY(id),
                    KEY order_id (order_id),
                    KEY user_type (user_type)
    )ENGINE=INNODB DEFAULT CHARSET=UTF8 COMMENT='发货状态记录库表';
    */

    protected $fillable = [
        'order_id',
        'old_status',
        'new_status',
        'notes',
        'user_type',
        'user_id',
        'show4user',
        'created_at',
        'updated_at'
    ];

    protected $table = 'status_shipping_record';

    public $timestamps = true;

    protected $primaryKey = 'id';

}
